package project.gui.creators;



import framework.events.Event;
import framework.gui.GUI;
import framework.gui.GUIObject;
import framework.gui.GUIObjectCreator;
import project.events.antEvents.FollowingExplorationAntCreatedEvent;
import project.events.antEvents.FollowingExplorationAntDiedEvent;
import project.gui.objects.GUIFollowingExplorationAnt;

public class GUIFollowingExplorationAntCreator extends GUIObjectCreator {

	public GUIFollowingExplorationAntCreator(GUI gui) {
		super(gui);
	}

	@Override
	protected GUIObject createGUIObject(Event event) {
		if (event instanceof FollowingExplorationAntCreatedEvent) {
			FollowingExplorationAntCreatedEvent e = (FollowingExplorationAntCreatedEvent) event;
			System.out.println("following exploration ant created");
			System.out.println(e.getPosition());
			return new GUIFollowingExplorationAnt(e.getId(), e.getPosition());
		} 
		
		else {
			throw new IllegalStateException();
		}
	}
	


	@Override
	protected Class<? extends Event> getCreationEventClass() {
		return FollowingExplorationAntCreatedEvent.class;
	}

	@Override
	protected Class<? extends Event> getDestroyEventClass() {
		return FollowingExplorationAntDiedEvent.class;
	}

	@Override
	protected GUIObject getDestroyGUIObject(Event event) {
		if (event instanceof FollowingExplorationAntDiedEvent) {
			FollowingExplorationAntDiedEvent e = (FollowingExplorationAntDiedEvent) event;
			return new GUIFollowingExplorationAnt(e.getId(), null);
		} else {
			throw new IllegalStateException();
		}
	}
}
